package com.mes.basicdata.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.common.domain.BasicModel;


/**
 * <p>
 * 日历数据
 * </p>
 * 
 * <p>
 * Created on 2017-03-18
 * </p>
 * 
 * @author lcs
 * 
 */
@Entity()
@Table(name = "R_CALENDAR_DATA")
@BatchSize(size=30)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CalendarData extends BasicModel implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public final static String EXCEPTION_TYPE_MAINTENANCE="MAINTENANCE";
	
	// 日历数据编号
	@Id
	@GenericGenerator(name = "calendarDataUid", strategy = "assigned")
	@Column(name="CD_UID")
	private String calendarDataUid;
	
	// 日历
	@Column(name="CAL_UID")
	private String calendarUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="CAL_UID",insertable=false,updatable=false)
	private Routing calendar;
	
	// 工作日
	@Column(name="CD_DAY_OR_EXCEPTION",precision=5,scale=0)
	private Integer dayOrException;
	// 是否工作
	@Column(name="CD_WORKING")
	private Boolean isWorking;
	// 起始时间
	@Column(name="CD_FROM_DATE",length=7)
	private Date fromDate;
	// 结束时间
	@Column(name="CD_TO_DATE",length=7)
	private Date toDate;
	// 第一班次开始时间
	@Column(name="CD_FROM_TIME1",length=7)
	private Date firstShiftFromTime;
	// 第一班次结束时间
	@Column(name="CD_TO_TIME1",length=7)
	private Date firstShiftToTime;
	// 第二班开始时间
	@Column(name="CD_FROM_TIME2",length=7)
	private Date secondShiftFromTime;
	// 第二班结束时间
	@Column(name="CD_TO_TIME2",length=7)
	private Date secondShiftToTime;
	// 第三班开始时间
	@Column(name="CD_FROM_TIME3",length=7)
	private Date thirdShiftFromTime;
	// 第三班结束时间
	@Column(name="CD_TO_TIME3",length=7)
	private Date thirdShiftToTime;
	// 第四班开始时间
	@Column(name="CD_FROM_TIME4",length=7)
	private Date fourthShiftFromTime;
	// 第四班结束时间
	@Column(name="CD_TO_TIME4",length=7)
	private Date fourthShiftToTime;
	// 第五班开始时间
	@Column(name="CD_FROM_TIME5",length=7)
	private Date fifthShiftFromTime;
	// 第五班结束时间
	@Column(name="CD_TO_TIME5",length=7)
	private Date fifthShiftToTime;
	
	@Column(name="CD_FROM_TIME6",length=7)
	private Date sixthShiftFromTime;
	
	@Column(name="CD_TO_TIME6",length=7)
	private Date sixthShiftToTime;
	
	@Column(name="CD_FROM_TIME7",length=7)
	private Date seventhShiftFromTime;
	
	@Column(name="CD_TO_TIME7",length=7)
	private Date seventhShiftToTime;
	
	@Column(name="CD_FROM_TIME8",length=7)
	private Date eighthShiftFromTime;
	
	@Column(name="CD_TO_TIME8",length=7)
	private Date eighthShiftToTime;
	
	// 例外原因
	@Column(name="EXCEPTION_REASON",length=50)
	private String exceptionReason;
	
	@Column(name="EFFECTIVE")
	private Boolean isEffective;
	
	@Column(name="INVALIDDATE")
	private Date invalidDate;
	
	@Column(name="EXCEPTION_TYPE")
	private String exceptionType;	
	
	@Column(name="SHIFT1",precision=5,scale=0)
	private Integer shift1;
	@Column(name="SHIFT2",precision=5,scale=0)
	private Integer shift2;
	@Column(name="SHIFT3",precision=5,scale=0)
	private Integer shift3;
	@Column(name="SHIFT4",precision=5,scale=0)
	private Integer shift4;
	@Column(name="SHIFT5",precision=5,scale=0)
	private Integer shift5;
	@Column(name="SHIFT6",precision=5,scale=0)
	private Integer shift6;
	@Column(name="SHIFT7",precision=5,scale=0)
	private Integer shift7;
	@Column(name="SHIFT8",precision=5,scale=0)
	private Integer shift8;
	
	//班次数量
	@Transient
	private Integer shiftNum;
	
	
	/** default constructor */
	public CalendarData() {

	}

	public String getCalendarDataUid() {
		return calendarDataUid;
	}

	public void setCalendarDataUid(String calendarDataUid) {
		this.calendarDataUid = calendarDataUid;
	}
	
	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getCalendarDataUid();
	}

	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setCalendarDataUid(uuid);
	}

	public String getCalendarUid() {
		return calendarUid;
	}

	public void setCalendarUid(String calendarUid) {
		this.calendarUid = calendarUid;
	}

	public Integer getDayOrException() {
		return dayOrException;
	}

	public void setDayOrException(Integer dayOrException) {
		this.dayOrException = dayOrException;
	}



	public Boolean getIsWorking() {
		return isWorking;
	}

	public void setIsWorking(Boolean isWorking) {
		this.isWorking = isWorking;
	}

	public Date getFromDate() {
		return fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	public Date getToDate() {
		return toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

	public Date getFirstShiftFromTime() {
		return firstShiftFromTime;
	}

	public void setFirstShiftFromTime(Date firstShiftFromTime) {
		this.firstShiftFromTime = firstShiftFromTime;
	}

	public Date getFirstShiftToTime() {
		return firstShiftToTime;
	}

	public void setFirstShiftToTime(Date firstShiftToTime) {
		this.firstShiftToTime = firstShiftToTime;
	}

	public Date getSecondShiftFromTime() {
		return secondShiftFromTime;
	}

	public void setSecondShiftFromTime(Date secondShiftFromTime) {
		this.secondShiftFromTime = secondShiftFromTime;
	}

	public Date getSecondShiftToTime() {
		return secondShiftToTime;
	}

	public void setSecondShiftToTime(Date secondShiftToTime) {
		this.secondShiftToTime = secondShiftToTime;
	}

	public Date getThirdShiftFromTime() {
		return thirdShiftFromTime;
	}

	public void setThirdShiftFromTime(Date thirdShiftFromTime) {
		this.thirdShiftFromTime = thirdShiftFromTime;
	}

	public Date getThirdShiftToTime() {
		return thirdShiftToTime;
	}

	public void setThirdShiftToTime(Date thirdShiftToTime) {
		this.thirdShiftToTime = thirdShiftToTime;
	}

	public Date getFourthShiftFromTime() {
		return fourthShiftFromTime;
	}

	public void setFourthShiftFromTime(Date fourthShiftFromTime) {
		this.fourthShiftFromTime = fourthShiftFromTime;
	}

	public Date getFourthShiftToTime() {
		return fourthShiftToTime;
	}

	public void setFourthShiftToTime(Date fourthShiftToTime) {
		this.fourthShiftToTime = fourthShiftToTime;
	}

	public Date getFifthShiftFromTime() {
		return fifthShiftFromTime;
	}

	public void setFifthShiftFromTime(Date fifthShiftFromTime) {
		this.fifthShiftFromTime = fifthShiftFromTime;
	}

	public Date getFifthShiftToTime() {
		return fifthShiftToTime;
	}

	public void setFifthShiftToTime(Date fifthShiftToTime) {
		this.fifthShiftToTime = fifthShiftToTime;
	}

	public Date getSixthShiftFromTime() {
		return sixthShiftFromTime;
	}

	public void setSixthShiftFromTime(Date sixthShiftFromTime) {
		this.sixthShiftFromTime = sixthShiftFromTime;
	}

	public Date getSixthShiftToTime() {
		return sixthShiftToTime;
	}

	public void setSixthShiftToTime(Date sixthShiftToTime) {
		this.sixthShiftToTime = sixthShiftToTime;
	}

	public Date getSeventhShiftFromTime() {
		return seventhShiftFromTime;
	}

	public void setSeventhShiftFromTime(Date seventhShiftFromTime) {
		this.seventhShiftFromTime = seventhShiftFromTime;
	}

	public Date getSeventhShiftToTime() {
		return seventhShiftToTime;
	}

	public void setSeventhShiftToTime(Date seventhShiftToTime) {
		this.seventhShiftToTime = seventhShiftToTime;
	}

	public Date getEighthShiftFromTime() {
		return eighthShiftFromTime;
	}

	public void setEighthShiftFromTime(Date eighthShiftFromTime) {
		this.eighthShiftFromTime = eighthShiftFromTime;
	}

	public Date getEighthShiftToTime() {
		return eighthShiftToTime;
	}

	public void setEighthShiftToTime(Date eighthShiftToTime) {
		this.eighthShiftToTime = eighthShiftToTime;
	}

	public String getExceptionReason() {
		return exceptionReason;
	}

	public void setExceptionReason(String exceptionReason) {
		this.exceptionReason = exceptionReason;
	}



	public Boolean getIsEffective() {
		return isEffective;
	}

	public void setIsEffective(Boolean isEffective) {
		this.isEffective = isEffective;
	}

	public Date getInvalidDate() {
		return invalidDate;
	}

	public void setInvalidDate(Date invalidDate) {
		this.invalidDate = invalidDate;
	}

	public String getExceptionType() {
		return exceptionType;
	}

	public void setExceptionType(String exceptionType) {
		this.exceptionType = exceptionType;
	}

	public CalendarData(Boolean isEffective) {
		super();
		this.isEffective = isEffective;
	}

	public Integer getShift1() {
		return shift1;
	}

	public void setShift1(Integer shift1) {
		this.shift1 = shift1;
	}

	public Integer getShift2() {
		return shift2;
	}

	public void setShift2(Integer shift2) {
		this.shift2 = shift2;
	}

	public Integer getShift3() {
		return shift3;
	}

	public void setShift3(Integer shift3) {
		this.shift3 = shift3;
	}

	public Integer getShift4() {
		return shift4;
	}

	public void setShift4(Integer shift4) {
		this.shift4 = shift4;
	}

	public Integer getShift5() {
		return shift5;
	}

	public void setShift5(Integer shift5) {
		this.shift5 = shift5;
	}

	public Integer getShift6() {
		return shift6;
	}

	public void setShift6(Integer shift6) {
		this.shift6 = shift6;
	}

	public Integer getShift7() {
		return shift7;
	}

	public void setShift7(Integer shift7) {
		this.shift7 = shift7;
	}

	public Integer getShift8() {
		return shift8;
	}

	public void setShift8(Integer shift8) {
		this.shift8 = shift8;
	}

	public Routing getCalendar() {
		return calendar;
	}

	public void setCalendar(Routing calendar) {
		this.calendar = calendar;
	}

	public Integer getShiftNum() {
		return shiftNum;
	}

	public void setShiftNum(Integer shiftNum) {
		this.shiftNum = shiftNum;
	}
	
	
	

}
